package com.laundry.controller;

import com.laundry.dto.ResultDTO;
import com.laundry.service.OrderService;
import com.laundry.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/api/admin")
public class AdminController {
    
    @Autowired
    private UserService userService;
    
    @Autowired
    private OrderService orderService;
    
    @GetMapping("/orders/legacy/list")
    public ResultDTO getOrders(@RequestParam(required = false) String orderNo, 
                              @RequestParam(required = false) Integer status) {
        try {
            // 简化处理，返回空列表
            return ResultDTO.success(orderService.getAllOrders());
        } catch (Exception e) {
            e.printStackTrace();
            return ResultDTO.error("获取订单列表失败");
        }
    }
    
    @PostMapping("/sendMessage")
    public ResultDTO sendMessage(@RequestBody Map<String, Object> message) {
        try {
            // 简化处理，实际应该保存消息到数据库或发送通知
            return ResultDTO.success();
        } catch (Exception e) {
            e.printStackTrace();
            return ResultDTO.error("发送消息失败");
        }
    }
} 